package com.shsmi.hq.controller.api;

import com.shsmi.hq.dto.CommonResult;
import com.shsmi.hq.entity.DataKxgh;
import com.shsmi.hq.service.impl.DataKxghService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/api/kxgh")
public class DataKxghController {

    @Autowired
    private DataKxghService dataKxghService;

    @GetMapping("/list_by_point_intersect")
    public CommonResult listByPointIntersect(@RequestParam(value = "x") float x,
                                             @RequestParam(value = "y") float y){
        try {
            List<DataKxgh> resultList = dataKxghService.listByPointIntersect(x,y);
            return new CommonResult().success(resultList);
        } catch (Exception e) {
            return new CommonResult().failed(e.getMessage());
        }
    }
}
